package jus.aor.talk.v5;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.net.InetAddress;
import java.rmi.Naming;
import java.rmi.server.UnicastRemoteObject;

import jus.aor.talk.ui.client.TalkEventIntervenantAdaptator;
import jus.aor.talk.ui.client._IntervenantComposant;
import jus.aor.talk.ui.client._TalkEventIntervenantAdaptator;
import jus.aor.talk.ui.server.TalkUi;

public class Client {
	protected static Forum forum;
	protected static jus.aor.talk.ui.client.TalkUi beanTalk1;
	protected static Intervenant intervenant1;
	protected static _TalkEventIntervenantAdaptator adaptator1;
	
	public static ForumInterface searchForum(String forum) {
		
		try {
			ForumInterface ret = (ForumInterface) Naming.lookup(forum);
			
			return ret;
		}
		catch(Exception e) {
			System.out.println(e);
			return null;
		}
		
	}
	
	public static void main( String[] args) throws Exception{
		Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();

		beanTalk1 = new jus.aor.talk.ui.client.TalkUi();
		beanTalk1.setSize(400,400);
		beanTalk1.setLocation((dim.width-beanTalk1.getWidth())/2,(dim.height-beanTalk1.getHeight())/2);

		intervenant1= new Intervenant();
		adaptator1 = new TalkEventIntervenantAdaptator(intervenant1);
		intervenant1.setAdaptator(adaptator1);
		beanTalk1.addTalkEventListener(adaptator1);
		adaptator1.addIntervenantEventListener(beanTalk1);
	}
}